//
//  ComposeTitleView.swift
//  CJPWB
//
//  Created by 陈锦彭 on 16/3/21.
//  Copyright © 2016年 chenjinpeng. All rights reserved.
//

import UIKit
import SnapKit
class ComposeTitleView: UIView {
    // MARK: - 控件
    lazy var topLabel : UILabel = UILabel()
    lazy var nameLabel : UILabel = UILabel()
    
    
    //重写构造函数
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupTitleView()
    }

    required init?(coder aDecoder: NSCoder) {
       super.init(coder: aDecoder)
        setupTitleView()
    }

}

// MARK: - 设置UI
extension ComposeTitleView {
    //设置标题内容
    private func setupTitleView() {
        //1.添加子控件
        addSubview(topLabel)
        addSubview(nameLabel)
        //2.给子控件设置约束
        topLabel.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self.snp_top)
            make.centerX.equalTo(self.snp_centerX)
        }
        nameLabel.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(topLabel.snp_bottom).offset(3)
            make.centerX.equalTo(self.topLabel.snp_centerX)
        }
        //3.给子控件设置内容
        topLabel.text = "发微博"
        topLabel.font = UIFont.systemFontOfSize(14)
        nameLabel.text = UserAccountViewModel.shareInstance.account?.screen_name
        nameLabel.font = UIFont.systemFontOfSize(13)
        nameLabel.textColor = UIColor.lightGrayColor()
        
    }

}